<template>
	<Layout class="p-5 bg-white">
		<Form :label-width="150">
			<Row>
			   <Col >
				   <FormItem class="w-50" label="标题">
					<Input type="text" v-model="carBuyClientVo.title" style="width: 500px;"/>
				   </FormItem>
				   <FormItem class="w-50" label="车主姓名">
				   	<Input  :rows="6" v-model="carBuyClientVo.personName" style="width: 500px;"/>
				   </FormItem>
				   <FormItem class="w-50" label="车主电话">
				   	<Input  :rows="6" v-model="carBuyClientVo.tel" style="width: 500px;"/>
				   </FormItem>
				   <FormItem class="w-50" label="车主微信">
				   	<Input  :rows="6" v-model="carBuyClientVo.wxNumber" style="width: 500px;"/>
				   </FormItem>
				   <FormItem class="w-50" label="描述">
					   <Input type="textarea" :rows="6" v-model="carBuyClientVo.details" style="width: 500px; height: 150px;"/>
				   </FormItem>
					
				   <FormItem style="position: absolute; top: 500px;left: 200px;">
					   
						   <Button @click="submit" type="primary">提交</Button>
						   <Button @click="cancel" class="ml-2">取消</Button>
					 
				   </FormItem>
				  <br>
			   </Col>
			</Row>
		
           
		</Form>
	</Layout>
</template>

<script>
	
	export default {
		data: function() {
			return {
				cbId : 0,
				carBuyClientVo : {},
				carBuyInfo : {}
			};
		},
		methods: {
			cancel: function() {
				this.$tabs.close();
			},
			submit: function() {
							let self = this;
							if (this.$data.carBuyClientVo.title.length == 0) {
								this.message.error("标题必须输入");
								return;
							}
							if (this.$data.carBuyClientVo.details.length == 0) {
								this.message.error("描述必须输入");
								return;
							}
							self.$data.carBuyInfo.cbId = self.$data.carBuyClientVo.cbId
							self.$data.carBuyInfo.title = self.$data.carBuyClientVo.title
							self.$data.carBuyInfo.details = self.$data.carBuyClientVo.details
			
							this.http.put({
								url: "/car-buy-client-vo/info",
								param: self.$data.carBuyInfo
							}).then(() => {
								self.message.info("修改成功");
								self.$tabs.close();
								this.$router.push({
									name: "carBuy"
								});
							});
						},
			init: function() {
				
				
				let self = this;
			
				self.http.get({
					url: "/car-buy-client-vo/info",
					param: {
						cbId : self.$data.cbId
					}
				}).then(data => {
					
					self.$data.carBuyClientVo = data;
					console.log(self.$data.carBuyClientVo)
				});
			    
			    
			
			}
		},
		created: function () {
			this.$data.cbId = this.$route.params.cbId;
			this.init();
		},
	}
</script>

<style>
</style>
